#include <bits/stdc++.h>

#define eb emplace_back
#define ep emplace
#define fi first
#define se second
#define in read<int>()
#define lin read<ll>()
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using vec = vector < int >;
using veg = vector < pii >;

template < typename T > T read() {
	T x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-', ch = getchar();
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

template < typename T > void chkmax(T &x, const T &y) { x = x > y ? x : y; }
template < typename T > void chkmin(T &x, const T &y) { x = x < y ? x : y; }

const int N = 1e5 + 10;
const int mod = 998244353;

int ifac[N << 2], fac[N << 2], Wn[N << 2], cnt[N];
int A[N << 2], B[N << 2], rev[N << 2], len;

int upd(const int &x) { return x + (x >> 31 & mod); }
ll qp(ll x, int t) { ll res = 1; for(; t; t >>= 1, x = x * x % mod) if(t & 1) res = res * x % mod; return res; }

void init(int l) {
	for(len = 1; len <= 2 * l; len <<= 1);
	for(int h = 1; h <= len; h <<= 1) Wn[h] = qp(3, (mod - 1) / h);
	fac[0] = 1; rep(i, 1, len) fac[i] = 1ll * fac[i - 1] * i % mod;
	ifac[len] = qp(fac[len], mod - 2); per(i, len - 1, 0) ifac[i] = 1ll * ifac[i + 1] * (i + 1) % mod;
}

void init_NTT(int l) {
	for(len = 1; len <= 2 * l; len <<= 1);
	rep(i, 1, len - 1) rev[i] = rev[i >> 1] >> 1 | (i & 1 ? len >> 1 : 0);
}

void NTT(int *f, int on = 1) {
	rep(i, 1, len - 1) if(i < rev[i]) swap(f[i], f[rev[i]]);
	for(int h = 2; h <= len; h <<= 1) {
		for(int i = 0; i < len; i += h) {
			int wn = Wn[h], ww = 1;
			for(int k = i; k < i + h / 2; k++) {
				int u = f[k], v = 1ll * f[k + h / 2] * ww % mod; ww = 1ll * ww * wn % mod;
				f[k] = upd(u + v - mod); f[k + h / 2] = upd(u - v);
			}
		}
	} if(on == -1) {
		reverse(f + 1, f + len); int invv = qp(len, mod - 2);
		rep(i, 0, len - 1) f[i] = 1ll * f[i] * invv % mod;
	}
}

char s[N];
int f[N], n;

void solve(int l, int r) {
	if(l == r) return;
	int mid = l + r >> 1; solve(l, mid);
	if(r - l <= 100) {
		rep(i, l, mid)
			if(s[i] == '>')
				rep(j, mid + 1, r) {
					if(cnt[j - 1] - cnt[i] & 1) f[j] = upd(f[j] - 1ll * f[i] * ifac[j - i] % mod);
					else f[j] = upd(f[j] + 1ll * f[i] * ifac[j - i] % mod - mod);
				}
		return solve(mid + 1, r);
	}
	init_NTT(r - l + 1);
	rep(i, 0, len) A[i] = B[i] = 0;
	rep(i, l, mid) if(s[i] == '>') A[i - l] = 1ll * f[i] * (cnt[i] & 1 ? 1 : mod - 1) % mod;
	rep(i, 0, r - l + 1) B[i] = ifac[i];
	NTT(A); NTT(B); rep(i, 0, len - 1) A[i] = 1ll * A[i] * B[i] % mod; NTT(A, -1);
	rep(i, mid + 1, r) if(~cnt[i - 1] & 1) f[i] = upd(f[i] - A[i - l]); else f[i] = upd(f[i] + A[i - l] - mod);
	solve(mid + 1, r);
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("1.in", "r", stdin);
#endif
	scanf("%s", s + 1); n = strlen(s + 1) + 1; s[0] = '>';
	cnt[0] = 1; f[0] = 1; rep(i, 1, n) cnt[i] = cnt[i - 1] + (s[i] == '>');
	init(n); solve(0, n); printf("%lld\n", 1ll * fac[n] * f[n] % mod);
	return 0;
}
